home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / machine / lwings.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  1KB  |  53 lines

  1. /***************************************************************************
  2.  
  3.   machine.c
  4.  
  5.   Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
  6.   I/O ports)
  7.  
  8. ***************************************************************************/
  9.  
  10. #include "driver.h"
  11. #include "cpu/z80/z80.h"
  12.  
  13.  
  14. int lwings_bank_register=0xff;
  15.  
  16. WRITE_HANDLER( lwings_bankswitch_w ){
  17.     unsigned char *RAM = memory_region(REGION_CPU1);
  18.     int bank = (data>>1)&0x3;
  19.     cpu_setbank(1,&RAM[0x10000 + bank*0x4000]);
  20.  
  21.     lwings_bank_register=data;
  22. }
  23.  
  24. int lwings_interrupt(void){
  25.     return 0x00d7; /* RST 10h */
  26. }
  27.  
  28. int avengers_interrupt( void ){ /* hack */
  29.     static int n;
  30.     if (keyboard_pressed(KEYCODE_S)){ /* test code */
  31.         while (keyboard_pressed(KEYCODE_S))
  32.         {}
  33.         n++;
  34.         n&=0x0f;
  35.         ADPCM_trigger(0, n);
  36.     }
  37.  
  38.     if( lwings_bank_register & 0x08 ){ /* NMI enable */
  39.         static int s;
  40.         s=!s;
  41.         if( s ){
  42.             return interrupt();
  43.             //cpu_cause_interrupt(0, 0xd7);
  44.         }
  45.         else {
  46.             return Z80_NMI_INT;
  47.         }
  48.     }
  49.  
  50.     return Z80_IGNORE_INT;
  51. }
  52.  
  53.